import 'package:bxultimate/app/theme/app_theme.dart';
import 'package:bxultimate/app/theme/gaps.dart';
import 'package:bxultimate/data/store/config_store.dart';
import 'package:bxultimate/widgets/mk_load_image.dart';
import 'package:bxultimate/widgets/mk_page.dart';
import 'package:bxultimate/widgets/mk_scroll_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

import 'controller.dart';

class HonourCardRcApplyPage extends StatefulWidget {
  const HonourCardRcApplyPage({Key? key}) : super(key: key);

  @override
  State<HonourCardRcApplyPage> createState() => _HonourCardRcApplyPageState();
}

class _HonourCardRcApplyPageState extends State<HonourCardRcApplyPage> {
  final controller = Get.find<HonourCardRcApplyController>();
  final state = Get
      .find<HonourCardRcApplyController>()
      .state;

  @override
  Widget build(BuildContext context) {
    return MkPage(
      child: Scaffold(
          backgroundColor: Colors.transparent,
          appBar: AppBar(
            title: Text('申请军创实体店证书'),
          ),
          body: MkScrollView(
            bottomButton: TDButton(
              text: '提交审核',
              theme: TDButtonTheme.primary,
              isBlock: true,
              height: 48,
            ),
            children: [
              boxWrap(Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    '营业执照照片',
                    style:
                    TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
                  ),
                  Gaps.vGap8,
                  Obx(() =>
                  state.shop.licensePhoto == null
                      ? SizedBox()
                      : MkLoadImage(
                    ConfigStore.to.baseFileUrl + state.shop.licensePhoto!,
                    height: 200,
                    fit: BoxFit.cover,
                    width: double.infinity,
                  ))
                ],
              )),
              Gaps.vGap12,
              boxWrap(Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    '请上传退役军人优待证',
                    style:
                    TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
                  ),
                  Gaps.vGap8,
                  Obx(() =>
                  state.shop.licensePhoto == null
                      ? SizedBox()
                      : ClipRRect(
                    borderRadius: BorderRadius.circular(10),
                    child: MkLoadImage(
                      'https://minio.sxmbxt.com/static/img/tyjrydz.png',
                      fit: BoxFit.cover,
                      width: double.infinity,
                    ),
                  ))
                ],
              )),

              Gaps.vGap12,
              boxWrap(Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text('申请须知',style: TextStyle(color: Colors.redAccent,fontSize: 18,fontWeight: FontWeight.bold),),
                  Gaps.vGap8,
                  Text('1、军创实体店标牌编号由系统生成，作为商家的唯一标识；'),
                  Text(
                      '2、申请“戎创实体”军创实体店实体标牌，需上传商家营业执照及法人退役军人优待证，经爱国拥军促进会审核通过后发放标牌，标牌工本费10元，邮寄费按照实际费用收取；'),
                  Text('3、若发现商家存在不法经营、不诚信经营等违规行为，或出现客户多次投诉、商家排名长期靠后等情况，发放单位有权收回此标牌。')
            ],
          ))


      ],
    ),)
    ,
    );
  }

  Widget boxWrap(child) {
    return Container(
      width: double.infinity,
      margin: EdgeInsets.only(
          left: AppTheme.iDefaultPadding, right: AppTheme.iDefaultPadding),
      padding: EdgeInsets.all(AppTheme.iDefaultPadding),
      decoration: BoxDecoration(
          color: Colors.white, borderRadius: BorderRadius.circular(8)),
      child: child,
    );
  }

  @override
  void dispose() {
    Get.delete<HonourCardRcApplyController>();
    super.dispose();
  }
}
